tools/python: change 's#' size type for Python >= 3.10
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tue, 21 Mar 2023 12:43:44 +0000 (13:43 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 Mar 2023 12:43:44 +0000 (13:43 +0100)
commit651ffe2c7847cb9922d22980984a3bea6f47bea7
tree27b9ed37d10ebd49b5dd4dcb87d9f52606983dc2
parentb745ff30113d2bd91e2d34cf56437b2fe2e2ea35
tools/python: change 's#' size type for Python >= 3.10

Python < 3.10 by default uses 'int' type for data+size string types
(s#), unless PY_SSIZE_T_CLEAN is defined - in which case it uses
Py_ssize_t. The former behavior was removed in Python 3.10 and now it's
required to define PY_SSIZE_T_CLEAN before including Python.h, and using
Py_ssize_t for the length argument. The PY_SSIZE_T_CLEAN behavior is
supported since Python 2.5.

Adjust bindings accordingly.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
master commit: 897257ba49d0a6ddcf084960fd792ccce9c40f94
master date: 2023-02-06 08:50:13 +0100
tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/lowlevel/xs/xs.c